package com.czk.durant.springframework.context.support;

import com.czk.durant.springframework.beans.factory.ConfigurableListableBeanFactory;
import com.czk.durant.springframework.exception.BeanException;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/6/21 11:21
 */
public class ClassPathXmlApplicationContext extends AbstractXmlApplicationContext {
    private String[] configLocations;

    public ClassPathXmlApplicationContext() {
    }

    /**
     * 从 XML 中加载 BeanDefinition，并刷新上下文
     *
     * @param configLocations
     * @throws BeanException
     */
    public ClassPathXmlApplicationContext(String configLocations) throws BeanException {
        this(new String[]{configLocations});
    }

    /**
     * 从 XML 中加载 BeanDefinition，并刷新上下文
     * @param configLocations
     * @throws BeanException
     */
    public ClassPathXmlApplicationContext(String[] configLocations) throws BeanException {
        this.configLocations = configLocations;
        refresh();
    }

    @Override
    protected String[] getConfigLocations() {
        return configLocations;
    }

    @Override
    protected ConfigurableListableBeanFactory getBeanFactory() {
        return null;
    }
}
